<template>
  <!-- 资源饰品类配置 -->
  <div class="pc-decoration">
    <search-form
      :search-config="searchConfig"
      :label-width="150"
      @clear="clearSearch"
      @search="handleSearch"
    />
    <c-permission-tabs v-model="activatedType" code="tab">
      <el-tab-pane label="全部" name="all" opt-code="all">
        <List :serach-filters="serachFilters" :active-type="activatedType" type="all" />
      </el-tab-pane>
      <el-tab-pane label="待配置" name="configuration" opt-code="configuration">
        <List :serach-filters="serachFilters" :active-type="activatedType" type="configuration" />
      </el-tab-pane>
      <el-tab-pane label="待清单确认" name="confirm" opt-code="confirm">
        <List :serach-filters="serachFilters" :active-type="activatedType" type="confirm" />
      </el-tab-pane>
      <el-tab-pane label="待提报需求" name="submit" opt-code="submit">
        <List :serach-filters="serachFilters" :active-type="activatedType" type="submit" />
      </el-tab-pane>
      <el-tab-pane label="待需求确认" name="confirmdemand" opt-code="confirmdemand">
        <List :serach-filters="serachFilters" :active-type="activatedType" type="confirmdemand" />
      </el-tab-pane>
      <el-tab-pane label="待打款确认" name="confirmremit" opt-code="confirmremit">
        <List :serach-filters="serachFilters" :active-type="activatedType" type="confirmremit" />
      </el-tab-pane>
      <el-tab-pane label="订单提报" name="ordersubmit" opt-code="ordersubmit">
        <List :serach-filters="serachFilters" :active-type="activatedType" type="ordersubmit" />
      </el-tab-pane>
    </c-permission-tabs>
  </div>
</template>

<script>
// import Search from '../components/search'
import List from './components/list'
export default {
  name: 'PCDecoration',
  components: {
    // Search,
    List
  },
  data() {
    return {
      activatedType: '',
      serachFilters: [],
      searchConfig: [
        {
          label: '任务来源',
          prop: 'source',
          type: 'select',
          config: {
            remote: true,
            remoteUrl: `/data-dict/api/v2/dictionary/PRODUCT_CONFIG_TASK_SOURCE?appCode=slm&domainCode=marketing`,
            defaultProps: { label: 'dictName', value: 'dictCode' }
          }
        },
        { label: '门店建设项目号', prop: 'constCode', type: 'text', value: '', placeholder: '' },
        { label: '产品配置任务号', prop: 'configTaskCode', type: 'text', value: '', placeholder: '' },

        {
          label: '所属门店',
          prop: 'shopCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'post',
            remoteUrl: '/select-service/api/v1/shop/page',
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'name',
              value: 'code'
            },
            selectData: []
          },
          dialogConfig: {
            title: '选择表格数据',
            interfacePath: '/select-service/api/v1/shop/page',
            setting: [{ prop: 'code', title: '编码' }, { prop: 'name', title: '名称' }],
            pageFlag: true
          }
        },
        {
          label: '所属客户',
          prop: 'clientCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'post',
            remoteUrl: '/select-service/api/v1/customer/page',
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'name',
              value: 'code'
            },
            selectData: [],
            apiHeader: { 'permission-code': 'decoration', 'Permission-App': 'slm' }
          },
          dialogConfig: {
            title: '选择表格数据',
            interfacePath: '/select-service/api/v1/customer/page',
            setting: [{ prop: 'code', title: '编码' }, { prop: 'name', title: '名称' }],
            pageFlag: true
          }
        },
        {
          label: '所属办事处',
          prop: 'officeCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'post',
            remoteUrl: '/select-service/api/v1/organization/page',
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'name',
              value: 'code'
            },
            selectData: []
          },
          dialogConfig: {
            title: '选择表格数据',
            interfacePath: '/select-service/api/v1/organization/page',
            setting: [{ prop: 'code', title: '编码' }, { prop: 'name', title: '名称' }],
            filtersRaw: [{ 'id': 'isOffice', 'property': 'isOffice', 'value': '1', 'operator': '=' }],
            pageFlag: true
          }
        },
        {
          label: '产品配置人',
          prop: 'proConfiguratorCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'post',
            remoteUrl: `${process.env.VUE_APP_BASE_API}/api/v1/configPersonnelAndOffice/perSonPage`,
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'personnelName',
              value: 'personnelCode'
            },
            selectData: []
          },
          dialogConfig: {
            title: '产品配置人',
            interfacePath: `${process.env.VUE_APP_BASE_API}/api/v1/configPersonnelAndOffice/perSonPage`,
            setting: [{ prop: 'personnelCode', title: '编码' }, { prop: 'personnelName', title: '名称' }],
            pageFlag: true
          }
        },
        {
          label: '产品配置类型',
          prop: 'proConfigType',
          type: 'select',
          config: {
            filterable: false, // 是否允许输入关键字搜索
            multiple: false, // 是否多选
            selectData: [
              { label: '饰品类', value: 'ACCESSORY' },
              { label: '资源类', value: 'RESOURCES' }
            ]
          }
        },
        {
          label: '产品分类明细',
          prop: 'classDetail',
          type: 'select',
          config: {
            remote: true,
            remoteUrl: `/data-dict/api/v2/dictionary/CLASS_DETAIL?appCode=slm&domainCode=marketing`,
            defaultProps: { label: 'dictName', value: 'dictCode' }
          }
        },
        {
          label: '发货方式',
          prop: 'deliveryMethod',
          type: 'select',
          config: {
            remote: true,
            remoteUrl: `/data-dict/api/v2/dictionary/DELIVERY_METHOD?appCode=slm&domainCode=marketing`,
            defaultProps: { label: 'dictName', value: 'dictCode' }
          }
        },
        {
          label: '产品配置进度',
          prop: 'schedule',
          type: 'select',
          config: {
            remote: true,
            remoteUrl: `/data-dict/api/v2/dictionary/ACC_SCHEDULE?appCode=slm&domainCode=marketing`,
            defaultProps: { label: 'dictName', value: 'dictCode' }
          }
        },
        {
          label: '产品配置状态',
          prop: 'state',
          type: 'select',
          config: {
            remote: true,
            remoteUrl: `/data-dict/api/v2/dictionary/PRODUCT_CONFIG_STATE?appCode=slm&domainCode=marketing`,
            defaultProps: { label: 'dictName', value: 'dictCode' }
          }
        }
      ]
    }
  },
  created() {
  },
  methods: {
    // 清空搜索条件
    clearSearch(data) {
      this.serachFilters = []
    },
    // 获取搜索条件
    handleSearch(data) {
      this.serachFilters = data.filtersRaw
    }
  }
}

</script>

<style lang="scss" scoped>

</style>
